using System.Globalization;
using System.Windows.Data;

namespace FileTransferDesktop.Converters;

public static class StringExtensions
{
    public static bool IsNullOrEmpty(string? value) => string.IsNullOrEmpty(value);

    public static Visibility IsNullOrEmptyToVisibility(string? value) =>
        string.IsNullOrEmpty(value) ? Visibility.Visible : Visibility.Collapsed;
}

public class StringIsNullOrEmptyConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return string.IsNullOrEmpty(value as string);
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

public class StringIsNullOrEmptyToVisibilityConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return string.IsNullOrEmpty(value as string) ? Visibility.Visible : Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
